$(function(){
	var param = $("#tabContent > .tab-pane.active").data();//上一层页面传来的参数
	paramTabPage[tabId] = param;//将上一个页面的值复制给这个页面
	showCondition(false);//让此页面不显示搜索条件
	$("#"+tabId+" #drgCode").html(paramTabPage[tabId].name);//增加新打开页签的drg描述
	var compareType = paramTabPage[tabId].compareType;//比较类型
	//根据传入的比较类型，显示不同的标题
	if(compareType=="manage"){
		$("#"+tabId+" .comType").html("超标[绩效]病例数");
	} 
	else if(compareType=="std")
	{
		$("#"+tabId+" .comType").html("超标[标杆]病例数");
	}
	else{
		$("#"+tabId+" .comType").html("超标[院内均值]病例数");
	}
	//根据传入的比较类型，显示不同的标题
	if(compareType=="manage"){
		$("#"+tabId+" .comType").html("超标[绩效]病例数<span data-toggle='keyDisGroAnalFeeDrug_tooltip' remark_title='次均费用超标的病例' style='color: #0072ff;'>[注]</span>");
	} 
	else if(compareType=="std")
	{
		$("#"+tabId+" .comType").html("超标[标杆]病例数<span data-toggle='keyDisGroAnalFeeDrug_tooltip' remark_title='次均费用超标的病例' style='color: #0072ff;'>[注]</span>");
	}
	else{
		$("#"+tabId+" .comType").html("超标[院内均值]病例数<span data-toggle='keyDisGroAnalFeeDrug_tooltip' remark_title='次均费用超标的病例' style='color: #0072ff;'>[注]</span>");
	}
	$(document).ajaxStop(function(){
		//备注的tiptitle
		$('[data-toggle="keyDisGroAnalFeeDrug_tooltip"]').mouseover(function(event){
			$.justToolsTip({
				events:event,
		        animation:"moveInTop",
		        //width:"300px",
		        contents:$(this).attr('remark_title'),
		        gravity:'top'
		    });
		});
	});
	//初始化滑块
	initSlider();
	getCaseFeeDistribute();//加载病例费用分布数据
	//加载趋势图
	//绑定趋势图传入quotas
	keyDisGroupTrendChart('AvgFeeθDrugRatio');
	
	var drgFeeDrugTableColumns = [
	                               {"data": "code"},
	                            	{"data": "InCaseCnt",
	        	                  		"render": function(obj, type, full) {
	        	                  			  if(full.InCaseCnt == 0){
	        	                  				  return full.InCaseCnt ;
	        	                  			  } else {
		        		                    	  return "<a href=\"javascript:void(0);\" onclick= \"loadCaseDtl('入组病例数','"+full.code+"','drgs', 'InCaseCnt')\">"+full.InCaseCnt+"</a>";
	        	                  			  }
	        		                      }
	                                },
		     	                  	{"data": "AvgFee"},
		    	                	{"data": "DrugRatio"},
		    	                  	{"data": "CMI"},
		    	                  	{"data": "ExcessCnt_F",
		    	                  		"render": function(obj, type, full) {
		    	                  			if(full.ExcessCnt_F == 0){
		    	                  				return full.ExcessCnt_F ;
		    	                  			} else {
			    		                    	return "<a href=\"javascript:void(0);\" onclick= \"loadCaseDtl('超标病例数','"+full.code+"','drgs', 'ExcessCnt_F')\">"+full.ExcessCnt_F+"</a>";
		    	                  			}
		    		                      }
		    	                  	},
		    	                  	{"data": "SpecificCnt_F",
		    	                  		"render": function(obj, type, full) {
		    	                  			if(full.SpecificCnt_F == 0){
		    	                  				return full.SpecificCnt_F ;
		    	                  			} else {
			    		                    	return "<a href=\"javascript:void(0);\" onclick= \"loadCaseDtl('费用特异病例数','"+full.code+"','drgs', 'SpecificCnt_F')\">"+full.SpecificCnt_F+"</a>";
		    	                  			}
		    		                	}
		    	                  	},
		    	                  	{"data": "AvgFee_F"},
		    	                  	{"data": "DrugRatio_F"},
		    	                 ];
		
	var drgDepFeeDrugTableColumns = [
	                                    {"data": "code"},
		        	                  	{"data": "desc"},
		        	                  	{"data": "InCaseCnt",
		        	                  		"render": function(obj, type, full) {
		        	                  			  if(full.InCaseCnt == 0){
		        	                  				  return full.InCaseCnt ;
		        	                  			  } else {
			        		                    	  return "<a href=\"javascript:void(0);\" onclick= \"loadCaseDtl('入组病例数','"+full.code+"','dep', 'InCaseCnt')\">"+full.InCaseCnt+"</a>";
		        	                  			  }
		        		                      }
		                                },
		        	                  	{"data": "AvgFee"},
		        	                  	{"data": "DrugRatio"},
		        	                	{"data": "CMI"},
		        	                	{"data": "ExcessCnt_F",
			    	                  		"render": function(obj, type, full) {
			    	                  			 if(full.ExcessCnt_F == 0){
		        	                  				  return full.ExcessCnt_F ;
		        	                  			  } else {
				    		                    	  return "<a href=\"javascript:void(0);\" onclick= \"loadCaseDtl('费用费用超标病例数','"+full.code+"','dep', 'ExcessCnt_F')\">"+full.ExcessCnt_F+"</a>";
		        	                  			  }
			    		                      }
			    	                  	},
			    	                	{"data": "SpecificCnt_F",
			    	                  		"render": function(obj, type, full) {
			    	                  			  if(full.SpecificCnt_F == 0){
		        	                  				  return full.SpecificCnt_F ;
		        	                  			  } else {
				    		                    	  return "<a href=\"javascript:void(0);\" onclick= \"loadCaseDtl('费用特异病例数','"+full.code+"','dep', 'SpecificCnt_F')\">"+full.SpecificCnt_F+"</a>";
		        	                  			  }
			    		                      }
			    	                  	},
		        	                  	{"data": "AvgFee_F"},
		        	                  	{"data": "DrugRatio_F"},
		        	                  	{"data": "operation",
		        	                  		"render": function(obj, type, full) {
		        		                    	  return "<a href=\"javascript:void(0);\" keyDisGroupCode = '"+full.code+"'><i class = 'fa fa-line-chart'></i></a>";
		        		                      }
		                          		},
		        	                 ] ;
	
	var quotas_drgFeeDrugTable = ['InCaseCnt','AvgFee','DrugRatio','CMI','ExcessCnt_F','SpecificCnt_F','AvgFee_F','DrugRatio_F']; //指标数组
	var quotas_drgDepFeeDrugTable = ['InCaseCnt','AvgFee','DrugRatio','CMI','ExcessCnt_F','SpecificCnt_F','AvgFee_F','DrugRatio_F']; //指标数组

	getTableData(0,"drgs",quotas_drgFeeDrugTable,"drgFeeDrugTable",drgFeeDrugTableColumns,"hosp") ;
	getTableData(0,"dep",quotas_drgDepFeeDrugTable,"drgDepFeeDrugTable",drgDepFeeDrugTableColumns,"mdc") ;
});
